package com.lizhivscaomei.dueros.tobaccoguider;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;

@EnableAsync
@EnableScheduling
@EnableJpaRepositories(basePackages = "com.lizhivscaomei.dueros.tobaccoguider.mapper.jpa")
@EnableElasticsearchRepositories(basePackages = "com.lizhivscaomei.dueros.tobaccoguider.mapper.es")
@SpringBootApplication
public class TobaccoGuiderApplication {

    public static void main(String[] args) {
        SpringApplication.run(TobaccoGuiderApplication.class, args);
    }

    @Bean
    public RestHighLevelClient esRestClient() {
        return new RestHighLevelClient(
                RestClient.builder(
                        new HttpHost("tobacco.lizhivscaomei.site", 9200, "http")));
    }
}
